home *** CD-ROM | disk | FTP | other *** search
- Path: prairienet.org!sjmccaug
- From: sjmccaug@prairienet.org (Scott J. McCaughrin)
- Newsgroups: comp.lang.c++
- Subject: Re: char vs. unsigned char ???
- Date: 20 Jan 1996 03:28:07 GMT
- Organization: University of Illinois at Urbana
- Message-ID: <4dpng7$4lj@vixen.cso.uiuc.edu>
- References: <DLGEKq.1zq@avalon.chinalake.navy.mil>
- Reply-To: sjmccaug@prairienet.org (Scott J. McCaughrin)
- NNTP-Posting-Host: firefly.prairienet.org
-
-
- In a previous article, charles_harvey@imdgw.chinalake.navy.mil (sean harvey) says:
-
- >I recently encorporated some functions from another program compiled and
- >linked under an older version (Microsoft C version 6.0) into my program
- >(MSVC 7.0).
- >
- >The alien code would not compile for me due, I guess to more rigorous
- >type-checking.
- >
- >He used a lot of unsigned char strings that generated compile errors on
- >calls to functions strlen, strcat and sprintf.
- >
- >So I changed his types to char and compiled cleanly but the program
- >crashes and I think it may be due to the changes.
- >
- In its simplest incarnation, 'unsigned char' uses all 8 bits of a byte,
- while 'signed char' allows for 7-bit, 2's-complement values. One advantage
- of the latter is to let EOF (= -1 in UNIX) be a short int (= unsigned char)
- in some systems. So one way to track your problem is to see where anything
- other than an unsigned char is used numerically.
-
- -- Scott McC.
-
-